package com.sl.biz.modular.product.controller;


import com.sl.biz.modular.product.dao.entity.ProductDO;
import com.sl.biz.modular.product.service.ProductBizService;
import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/product")
@RequiredArgsConstructor
public class ProductController {

    private final ProductBizService productBizService;

    @PostMapping("/save")
    public Boolean save(@RequestBody @Validated ProductDO addRequest) {
        return productBizService.save(addRequest);
    }

    @PostMapping("/list")
    public List<ProductDO> list() {
        return productBizService.list();
    }


    @PostMapping("/delete_by_id")
    public Boolean deleteById(@RequestBody @Validated ProductDO addRequest) {
        return productBizService.deleteById(addRequest);
    }


}
